// import { getInsuranceRechargeDetail, getRechargeDetailInfo, getContractDetailInfo } from '../../api/insurance.js'
import user from '../../../utils/user'
import {
    getmessagerechargedetailapi,
}
from '../../api/message'
Page({

    /**
     * 页面的初始数据
     */
    data: {
        status: '',
        id: '',
        photo: "",
        money: "",
    },

    /**
     * 生命周期函数--监听页面加载
     */
    async onLoad(options) {
        console.log(options);
        this.setData({
            id: options.id
        })
        let res = await getmessagerechargedetailapi(this.data.id)
        console.log(res);
        this.setData({
            status: res.status,
            photo: res.voucherUrl,
            money: res.payMoney,
        })
    },
    preview() {
        wx.previewImage({
            urls: [this.data.photo],
        })
    },
    async getRechargeDetailInfo() {
        const result = await getRechargeDetailInfo({
            id: this.data.id
        })
        console.log('调用啦')
        this.setData({
            status: result.status,
            photo: result.voucherUrl,
            money: result.payMoney,
            insureCompanyType: user.insureCompanyType
        })
    },
    // 电子签充值记录
    async getContractDetailInfo() {
        const result = await getContractDetailInfo({
            id: this.data.id
        })
        console.log(result, 'resultresult')
        this.setData({
            status: result.status,
            photo: result.voucherUrl,
            money: result.rechargeAmount,
            insureCompanyType: user.insureCompanyType
        })
    }
})